home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
59425
/
59425.xpi
/
chrome
/
content
/
general.js
< prev
next >
Wrap
Text File
|
2010-02-05
|
1KB
|
39 lines
if (!favmarks) var favmarks = {}
favmarks.pref = function (name, val){
name = "extensions.favmarks."+name
return (val != undefined) ? favmarks.rawpref(name, val) : favmarks.rawpref(name)
}
favmarks.rawpref = function (name, val){
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch)
if (val != undefined)
switch(prefs.getPrefType(name)){
case prefs.PREF_STRING: return prefs.setCharPref(name, val)
case prefs.PREF_INT: return prefs.setIntPref(name, val)
case prefs.PREF_BOOL: return prefs.setBoolPref(name, val)
}
else
switch(prefs.getPrefType(name)){
case prefs.PREF_STRING: return prefs.getCharPref(name)
case prefs.PREF_INT: return prefs.getIntPref(name)
case prefs.PREF_BOOL: return prefs.getBoolPref(name)
}
}
favmarks.log = function (str){
Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.logStringMessage("Favmarks: "+str)
}
favmarks.logobj = function (obj, filter){
if (filter == undefined) var filter = ""
var t = []
for (var i in obj)
try {
if (i.match(filter))
t.push(i+": "+String(obj[i]).split("\n").reverse().pop())
}
catch(e){}
favmarks.log(t.sort().join("\n"))
}